<?
require("config.php");

require($rela_path . "bin/country.php");

$location_status .= " | Add";

$show_backnav = "order_menu";

$menutype = 2;

if (NULL!=$action){
	$purchase_date=strtotime($purchase_date);
	$delivery_date=strtotime($delivery_date);

   $field = array(
	"no",
	"trans_no",
	"purchase_date",
	"member_code",
	"member_name",
	"member_email",
	"recipient_title",
	"recipient_name",
	"recipient_email",
	"shipping_carrier",
	"shipping_region",
	"hkid",
	"recipient_address",
	"recipient_country",
	"recipient_zip",
	"recipient_tel",
	"recipient_mobile",
	"billing_address",
	"billing_country",
	"billing_zip",
	"order_status",
	"shipping_status",
	"delivery_date"
	);


   $content = array(
	$no,
	$trans_no,
	$purchase_date,
	$member_code,
	$member_name,
	$member_email,
	$recipient_title,
	$recipient_name,
	$recipient_email,
	$shipping_carrier,
	$shipping_region,
	$hkid,
	$recipient_address,
	$recipient_country,
	$recipient_zip,
	$recipient_tel,
	$recipient_mobile,
	$billing_address,
	$billing_country,
	$billing_zip,
	$order_status,
	$shipping_status,
	$delivery_date
	);

   myInsert($table,$field,$content);


   header("location:" . $rela_path . "share/msg.php?v=25");

   exit();

}

/*if (checkNo($table,$no)){

	header("location:" . $rela_path . "share/msg.php?v=9001");
	exit();

}
*/
require($rela_path . "inc/header.php");

if ($cid){

$Query = "SELECT 
	code,
	firstname,
	lastname,
	country,
	address,
	zipcode,
	tel,
	fax,
	email,
	mobile
FROM cus_info WHERE id=$cid";

$r = myQuery($Query);

	$member_code=	$r[0][0];
	$member_name=	$r[0][1].' '.$r[0][2];
	$member_email=	$r[0][8];
}

?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>


<table width="95%" border="0" align="center">
  <tr> 
    <td valign="top"> 
      <div align="right"></div>

<form action="" method="post" name="form1">  

<!--hidden filed-->
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">

<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">

	<input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('../order_menu.php',1);return false;"> 
	<input type="image" onClick="MM_validateForm('no','','RisNum','trans_no','','RisNum','purchase_date','','R','member_code','','R','member_name','','R','member_email','','RisEmail','recipient_name','','R','recipient_email','','RisEmail','hkid','','R','recipient_address','','R','recipient_zip','','R','recipient_tel','','R','recipient_mobile','','R','billing_address','','R','billing_zip','','R','order_status','','R','shipping_status','','R','delivery_date','','R');return document.MM_returnValue" src="../../images/bt_save.gif" width="76" height="22"> 

    </td>
  </tr>
</table>

        <table border="0" cellspacing="0" cellpadding="2">
          <tr> 
            <td class="tdheader">No :</td>
            <td> <input name="no" type="text" class="text" id="no" value=<?print($no)?> > </td>
          </tr>
          <tr> 
            <td class="tdheader">Transaction No :</td>
            <td> <input name="trans_no" type="text" class="text" id="trans_no"> </td>
          </tr>
          <tr> 
            <td class="tdheader">Purchase Date :</td>
            <td> <input name="purchase_date" type="text" class="text" id="purchase_date" value=<?print(date("Y-m-d"))?>> </td>
          </tr>
          <tr> 
            <td class="tdheader">Member Code :</td>
            <td> <input name="member_code" type="text" class="text" id="member_code" value="<?=$member_code?>"> 
            <input type="button" class="button" name="Submit22" value="..." onClick="Redirect('<?print($rela_path)?>listing/customer_list2.php?fillform=y',2)"> 
            </td>


          </tr>
          <tr> 
            <td class="tdheader">Member Name :</td>
            <td>  <input name="member_name" type="text" class="text" id="member_name" value="<?=$member_name?>" size="55"> 
            </td>
          </tr>
          <tr> 
            <td class="tdheader">Member Email : </td>
            <td><input name="member_email" type="text" class="text" id="member_email" value="<?=$member_email?>" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">&nbsp;</td>
            <td>  </td>
          </tr>
          <tr bgcolor="#CCCCCC"> 
            <td colspan="2" class="tdheader">Recipient Details </td>
          </tr>
          <tr> 
            <td class="tdheader">Title :</td>
            <td><input name="recipient_title" type="radio" value="Mr." checked>
              Mr. 
                <input type="radio" name="recipient_title" value="Ms.">
                Ms. 
                <input type="radio" name="recipient_title" value="Mrs.">
                Mrs.
              </td>
          </tr>
          <tr> 
            <td class="tdheader">Recipient Name : </td>
            <td><input name="recipient_name" class="text" type="text" id="recipient_name" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Contact Email : </td>
            <td><input name="recipient_email" class="text" type="text" id="recipient_email" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">&nbsp;</td>
            <td></td>
          </tr>
          <tr> 
            <td colspan="2" bgcolor="#CCCCCC" class="tdheader">Delivery Method </td>
          </tr>
          <tr> 
            <td class="tdheader">Shipping Carrier: </td>
            <td><select name="shipping_carrier" id="shipping_carrier">
              <option value="Air Mail" selected>Air Mail</option>
              <option value="Express">Express</option>
              <option value="Mail">Mail</option>
              <option value="Self Take">Self Take</option>
            </select></td>
          </tr>
          <tr> 
            <td class="tdheader">Shipping Region: </td>
            <td><?print(FFPCountry("China","shipping_region"))?></td>
          </tr>
          <tr> 
            <td class="tdheader">HK ID# : </td>
            <td><input name="hkid" class="text" type="text" id="hkid" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">&nbsp;</td>
            <td></td>
          </tr>
          <tr> 
            <td colspan="2" bgcolor="#CCCCCC" class="tdheader">Delivery Address </td>
          </tr>
          <tr> 
            <td class="tdheader">Recipient's Address : </td>
            <td><input name="recipient_address" class="text" type="text" id="recipient_address" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Country : </td>
            <td><?print(FFPCountry("China","recipient_country"))?></td>
          </tr>
          <tr> 
            <td class="tdheader">Zipcode : </td>
            <td><input name="recipient_zip" class="text" type="text" id="recipient_zip" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Contact Phone : </td>
            <td><input name="recipient_tel" class="text" type="text" id="recipient_tel" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Mobile / Pager : </td>
            <td><input name="recipient_mobile" class="text" type="text" id="recipient_mobile" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td colspan="2" bgcolor="#CCCCCC" class="tdheader">Billing Address </td>
          </tr>
          <tr> 
            <td class="tdheader">Billing Address :</td>
            <td><input name="billing_address" class="text" type="text" id="billing_address" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Country  : </td>
            <td><?print(FFPCountry("China","billing_country"))?></td>
          </tr>
          <tr> 
            <td class="tdheader">Zipcode :</td>
            <td><input name="billing_zip" class="text" type="text" id="billing_zip" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Order Status :</td>
            <td><input name="order_status" class="text" type="text" id="order_status" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Shipping Status:</td>
            <td><input name="shipping_status" class="text" type="text" id="shipping_status" size="55"></td>
          </tr>
          <tr> 
            <td class="tdheader">Delivery Date : </td>
            <td><input name="delivery_date" class="text" type="text" id="delivery_date" size="55"></td>
          </tr>
        </table>
        <br>
        <br><br>
<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">

	<input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('../order_menu.php',1);return false;"> 
	<input type="image" onClick="MM_validateForm('no','','RisNum','trans_no','','RisNum','purchase_date','','R','member_code','','R','member_name','','R','member_email','','RisEmail','recipient_name','','R','recipient_email','','RisEmail','hkid','','R','recipient_address','','R','recipient_zip','','R','recipient_tel','','R','recipient_mobile','','R','billing_address','','R','billing_zip','','R','order_status','','R','shipping_status','','R','delivery_date','','R');return document.MM_returnValue" src="../../images/bt_save.gif" width="76" height="22"> 

    </td>
  </tr>
</table>


</form>
<!--
        <hr> <br>
      <form name="form2" method="post" action="">
        <table border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td width="20%"><u><b>Sub Item</b></u></td>
            <td width="80%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="20%">Product Code :</td>
            <td width="80%"> <input type="text" class="text" name="ProductCode"> 
              <input type="submit" class="button" name="Submit2" value="..."> 
            </td>
          </tr>
          <tr> 
            <td width="20%">Unit Price : </td>
            <td width="80%"> <input type="text" class="text" name="Price"> </td>
          </tr>
          <tr> 
            <td width="20%">Qty :</td>
            <td width="80%"> <input type="text" class="text" name="Qty"> </td>
          </tr>
          <tr> 
            <td width="20%">&nbsp;</td>
            <td width="80%"> <input type="submit" class="button" name="Submit3" value="Add to List"> 
            </td>
          </tr>
        </table>
      </form>
      <br> 
        <table border="0" cellspacing="1" cellpadding="0" class="tb">
          <tr bgcolor="#CCCCCC"> 
            <td width="3%"> <div align="center">No.</div></td>
            <td width="16%"> <div align="center">Product Code</div></td>
            <td width="43%"> <div align="center">Product Name</div></td>
            <td width="10%"> <div align="center">Unit Price</div></td>
            <td width="10%"> <div align="center">Qty</div></td>
            <td width="18%"> <div align="center">Amount</div></td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">1</td>
            <td width="16%">ab102-222-23</td>
            <td width="43%">Basic Jean</td>
            <td width="10%"> <div align="right">99.00</div></td>
            <td width="10%"> <div align="right">100</div></td>
            <td width="18%"> <div align="right">9,900.00</div></td>
            <td width="18%"> <div align="center"><a href="#">edit</a> <a href="#">delete</a></div></td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td width="3%">&nbsp;</td>
            <td width="16%">&nbsp;</td>
            <td width="43%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="10%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr> 
            <td colspan="7"><div align="right">Total Amount : 9,900.00</div></td>
          </tr>
        </table>
-->        
      </td>

  </tr>
</table>

<br>
<br>
<br>
<?
require($rela_path . "inc/footer.php");
?>
